import 'package:flutter/cupertino.dart';
import 'package:flutter/foundation.dart';

/// FileName cupertino_localizations
///
/// @Author lax
/// @Date 2024/5/31
///
/// @Description

class PublicCupertinoLocalizations extends DefaultCupertinoLocalizations {
  static const List<String> _months = <String>[
    '01',
    '02',
    '03',
    '04',
    '05',
    '06',
    '07',
    '08',
    '09',
    '10',
    '11',
    '12',
  ];

  @override
  String datePickerMonth(int monthIndex) => _months[monthIndex - 1];

  static Future<PublicCupertinoLocalizations> load(Locale locale) {
    return SynchronousFuture<PublicCupertinoLocalizations>(PublicCupertinoLocalizations());
  }

  static const LocalizationsDelegate<PublicCupertinoLocalizations> delegate =
      _CupertinoLocalizationsDelegate();
}

class _CupertinoLocalizationsDelegate
    extends LocalizationsDelegate<PublicCupertinoLocalizations> {
  const _CupertinoLocalizationsDelegate();

  @override
  bool isSupported(Locale locale) => locale.languageCode == 'en';

  @override
  Future<PublicCupertinoLocalizations> load(Locale locale) =>
      PublicCupertinoLocalizations.load(locale);

  @override
  bool shouldReload(_CupertinoLocalizationsDelegate old) => false;

  @override
  String toString() => 'PublicCupertinoLocalizations.delegate(en_US)';
}
